<?php namespace simpleFlow\request;

/**
 * Manage requests
 * @package simpleFlow
 * @subpackage request
 * @author Guilherme Fontenele
 */
class Request
{
	/**
	 * @var array Parameters
	 */
	private $arrParams;
	/**
	 * @var string Protocol name
	 */
	protected $strProtocol;
	/**
	 * @var string Host
	 */
	protected $strHost;
	
	/**
	 * Constructor
	 * @param array $arrParams Parameters
	 */
	public function __construct($arrParams = array())
	{
		$this->strProtocol = $arrParams['_protocol_'];
		$this->strHost = $arrParams['_host_'];
		$this->arrParams = $arrParams;
	}
	
	/**
	 * Define parameter
	 * @param string $param Parameter name
	 * @param id $value Parameter
	 */
	public function setParam($param,$value)
	{
		$this->arrParams[$param] = $value;
	}
	
	/**
	 * Get parameter
	 * @param string $param Parameter name
	 * @return id Parameter
	 */
	public function getParam($param)
	{
		return $this->hasParam($param) ? $this->arrParams[$param] : '';
	}
	
	/**
	 * Verify if have a parameter
	 * @param string $param Parameter name
	 * @return boolean
	 */
	public function hasParam($param)
	{
		return isset($this->arrParams[$param]) ? true : false;
	}
	
	/**
	 * Get all parameters
	 * @return array Parameters
	 */
	public function getParams()
	{
		return $this->arrParams;
	}
	
	/**
	 * Remove a parameter
	 * @param string $param Parameter name
	 * @return Request self
	 */
	public function removeParam($param)
	{
		if($this->hasParam($param))
		{
			unset($this->arrParams[$param]);
		}
		return $this;
	}
}

?>